<?php

namespace App\Admin\Extensions\Tools;

use Encore\Admin\Grid\Tools\BatchAction;

class contentColumn extends BatchAction
{
    protected $tag_content_type;

    public function __construct($tag_content_type)
    {
        $this->tag_content_type = $tag_content_type;
    }

    public function script()
    {
        return <<<EOT
        $('{$this->getElementClass()}').on('click', function() {
            var ids = selectedRows();
            if(ids =='' || ids == null || typeof(ids)=='undefined'){
              layer.msg("请勾选数据!", {
                    icon: 5
              });
              return false;
            }
            
            $('#add-content-tag-modal').modal({
              remote: '/admin/application/column_assets/selectColumn/modal?content_id='+selectedRows()+'&content_type={$this->tag_content_type}'
            });
        });

EOT;

    }
}